<!DOCTYPE html>
<html>
<head>
    <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"
          type="text/css"/>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap3-dialog/1.34.9/css/bootstrap-dialog.min.css"
          rel="stylesheet" type="text/css"/>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap3-dialog/1.34.9/js/bootstrap-dialog.min.js"></script>
    <title>Button Event</title>
    <meta charset="utf-8"/>
</head>
<body>
<script type="text/javascript">
    $(function () {
        var dialog = new BootstrapDialog({
            closable: false,
            buttons: [{
                label: 'Button 1',
                action: function (dialog, event) {
                    // this.data('button') is the original button config
                    console.log(this.data('button'));

                    // Stop bubbling. 'event' here is the original event object of 'click'.
                    event.stopPropagation();
                }
            }, {
                label: 'Button 2',
                action: function (dialog) {
                    // Does nothing
                }
            }],
            onshown: function (dialog) {
                var $footer = dialog.getModalFooter();
                $footer.on('click', function (event) {
                    alert('Footer was hit.');
                });
            }
        });
        dialog.open();
    });
</script>
</body>
</html>
